#pragma once

#include <string>
#include <sstream>

#include "platform.h"
#include "MemoryReader.h"

class MemoryAddress
{
public:
	MemoryAddress(const address_t address_);

	operator const address_t() const;

	const std::string str() const;

	const std::wstring wstr() const;

	template <class POD> // shall only be used with Plain Old Data objects
	POD as(MemoryReader& reader, const address_t offset = 0) const
	{
		POD ret;
		reader.read(address + offset, ret);
		return ret;
	}

	const MemoryAddress ptr(MemoryReader& reader, const address_t offset = 0) const;

	const address_t value() const;

	void set(address_t addr);

protected:
	address_t address;
};
